package com.github_dididipapa.mall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import com.github_dididipapa.common.validator.group.AddGroup;
import com.github_dididipapa.common.validator.group.UpdateGroup;
import com.github_dididipapa.common.transmonitor.IsShowStatus;
import com.github_dididipapa.common.validator.group.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;


/**
 * 品牌
 * 
 * @author dididipapa
 * @email not_found@404.com
 * @date 2025-04-26 18:14:11
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	//策略模式分组校验

	/**
	 * 品牌id
	 */
	@TableId
	@NotNull(message = "更新时品牌id不能为空", groups = {UpdateGroup.class})
	@Null(message = "新增时品牌id必须为空", groups = {AddGroup.class})
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空", groups = {AddGroup.class, UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo-url地址
	 */
	@NotBlank(message = "logo不能为空", groups = {AddGroup.class})
	@URL(message = "logo必须是一个合法的url地址", groups = {AddGroup.class, UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "显示状态不能为空",  groups = {AddGroup.class, UpdateGroup.class,  UpdateStatusGroup.class})
	@IsShowStatus(values = {0,1},  groups = {AddGroup.class, UpdateGroup.class, UpdateStatusGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "首字母不能为空", groups = {AddGroup.class})
	@Size(min=1, max=1 , message = "首字母长度必须介于 1 和 1 之间", groups = {AddGroup.class, UpdateGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母", groups = {AddGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序不能为空",  groups = {AddGroup.class})
	@Min(value = 0, message = "排序必须大于等于0",  groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;

}
